<template>
    <view class="uni-padding-wrap container">
      <button @click="scrollToBottom">scrollToBottom</button>
      <button class="uni-btn" @click="navigateToNewPage3">navigateTo page3.uvue</button>
    </view>
</template>

<script>
import { state, setLifeCycleNum } from '@/store/index'

export default {
  data() {
    return {
      isScrolled: false,
    }
  },
  onLoad() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 100)
  },
  onShow() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onReady() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onPullDownRefresh() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onPageScroll(_) {
    // 自动化测试
    this.isScrolled = true
  },
  onReachBottom() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum + 10)
  },
  onBackPress() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum - 10)
    return null
  },
  onHide() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum - 10)
  },
  onUnload() {
    // 自动化测试
    setLifeCycleNum(state.lifeCycleNum - 100)
  },
  methods: {
    // 自动化测试
    getLifeCycleNum() {
      return state.lifeCycleNum
    },
    // 自动化测试
    setLifeCycleNum(num) {
      setLifeCycleNum(num)
    },
    pullDownRefresh() {
      uni.startPullDownRefresh({
        success() {
          setTimeout(() => {
            uni.stopPullDownRefresh()
          }, 2000)
        },
      })
    },
    scrollToBottom() {
      uni.pageScrollTo({
        scrollTop: 2000
      })
    },
    navigateToNewPage3() {
      uni.navigateTo({url: '/pages/navigator/new-page/new-page-3'})
    }
  },
}
</script>

<style>
.container {
  height: 1200px;
}
</style>
